package com.ddsso.auth.web.vo;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.realm.AuthenticatingRealm;
import org.springframework.stereotype.Component;
/**
 * @author zdd
 * @package com.ddsso.auth.web.vo
 * @Time Created by zdd on 2016/11/2.
 * @description 验证逻辑
 */
public class UserRealm extends AuthenticatingRealm {
    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        UserToken userToken = (UserToken) token;
        return new SimpleAuthenticationInfo(userToken.getLoginName(), userToken.getPassword(), getName());
    }

    @SuppressWarnings("rawtypes")
    @Override
    public Class getAuthenticationTokenClass() {
        return UserToken.class;
    }
}
